<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://meerkat.qunar.com/web" prefix="web" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<web:designCss/>
<%@include file="/WEB-INF/include/head.jsp" %>
<style type="text/css">
.list td {text-align:center;}
</style>
</head>
<body>
    <web:defineCodeList id="competitorStatusLoader" />
    <div class="wrapper">
        <form name="search" action="${PATH}competitor/list.htm">
        <web:titleBar title="查询条件" />
        <div class="main content">
            <table>
                <tr>
                    <td>报名序号</td>
                    <td><input type="text" name="inviteCode" value="${cond.inviteCode}" /></td>
                    <td>导游姓名</td>
                    <td><input type="text" name="name" value="${cond.name}" /></td>
                    <td>状态</td>
                    <td>
                    <select name="status">
                        <option></option>
                        <c:forEach var="item" items="${competitorStatusLoader}">
                        <option value="${item.id}" <c:if test="${item.id==cond.status}">selected</c:if>>${item.name}</option>
                        </c:forEach>
                    </select>
                    </td>
                    <td><input type="submit" class="button button-blue" value="检索" /></td>
                    <web:ifAuthorized path="${PATH}competitor/export">
                    <td><a href="export.htm" onclick="javascript:doExport(this);" class="button button-blue">导出</a></td>
                    </web:ifAuthorized>
                </tr>
                <tr>
                    <td>所属学校</td>
                    <td><input type="text" name="school" value="${cond.school}" /></td>
                    <td>所属专业</td>
                    <td><input type="text" name="major" value="${cond.major}" /></td>
                </tr>
            </table>
        </div>
        </form>
        <script type="text/javascript">
        <!--
        function doExport(obj) {
        	obj.href="export.htm?inviteCode=" + document.search.inviteCode.value
        			+"&name=" + document.search.name.value
        			+"&status=" + document.search.status.value
        			+"&school="+ document.search.school.value
        			+"&major="+ document.search.major.value;
        }
        //-->
        </script>
        <web:titleBar title="选手列表" />
        <div class="main content">
            <table class="list" width="95%" cellpadding="1" cellspacing="1">
                <tr>
                    <th width="20">ID</th>
                    <th width="65">报名序号</th>
                    <th>姓名</th>
                    <th>所属学校</th>
                    <th>所属专业</th>
                    <th>年级</th>
                    <th>得票数</th>
                    <th>状态</th>
                    <th width="110">创建时间</th>
                    <th width="110">更新时间</th>
                    <th colspan="2">操作</th>
                </tr>
                <c:forEach var="item" items="${lstObj.beans}">
                <tr>
                    <td>${item.id}</td>
                    <td><a href="detail.htm?id=${item.id}">${item.inviteCode}</a></td>
                    <td>${item.name}</td>
                    <td>${item.school}</td>
                    <td>${item.major}</td>
                    <td>${item.grade}</td>
                    <td>${item.voteCount}</td>
                    <td><web:writeCodeValue name="item" property="status" codeList="competitorStatusLoader"/></td>
                    <td><web:date name="item" property="created" pattern="yyyy/MM/dd HH:mm:ss"/></td>
                    <td><web:date name="item" property="updated" pattern="yyyy/MM/dd HH:mm:ss"/></td>
                    <td width="65">
                    <c:if test="${item.status==0}">
                        <web:ifAuthorized path="${PATH}competitor/active">
                        <a href="active.htm?id=${item.id}" class="button">激活</a>
                        </web:ifAuthorized>
                    </c:if>
                    </td>
                    <td width="65">
                    <c:if test="${item.status!=2}">
                        <web:ifAuthorized path="${PATH}competitor/delete">
                        <a href="delete.htm?id=${item.id}" class="button">删除</a>
                        </web:ifAuthorized>
                    </c:if>
                    </td>
                </tr>
                </c:forEach>
                <c:if test="${fn:length(lstObj.beans) == 0}">
                    <tr>
                        <td colspan="12">没有找到记录</td>
                    </tr>
                </c:if>
                <tr>
                    <td colspan="12" style="text-align:right;">
                    <web:pageLinks 
                            name="lstObj"
                            form="search"
                            submit="true"
                            rowProperty="row"
                            totalProperty="totalCount"
                            indexProperty="startIndex"/>
                    <span>${currentPageIndex}</span>/
                    <span>${totalPageCount}</span>
                    <span>(${lstObj.totalCount})</span>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</body>
</html>